package cn.miaopasi.boot.clickhouse.service.impl;

import cn.miaopasi.boot.clickhouse.mapper.AppInfoMapper;
import cn.miaopasi.boot.clickhouse.model.AppInfo;
import cn.miaopasi.boot.clickhouse.service.IAppInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * App接口实现
 *
 * @author Administrator
 */
@Service
public class AppInfoServiceImpl extends ServiceImpl<AppInfoMapper, AppInfo> implements IAppInfoService {
    @Override
    public Page<AppInfo> page(Long current, Long size) {
        Page<AppInfo> pageObj = new Page<>();
        pageObj.setCurrent(current);
        pageObj.setSize(size);
        return page(pageObj);
    }

    @Override
    public AppInfo findBySecret(String secretId, String secretKey) {
        AppInfo appInfo = AppInfo.builder()
                .secretId(secretId)
                .secretKey(secretKey)
                .build();
        return getOne(new LambdaQueryWrapper<AppInfo>().setEntity(appInfo));
    }
}
